clang tidy modernize-use-auto on gui.
authortsteven4 <13596209+tsteven4@users.noreply.github.com>
Wed, 27 May 2020 20:31:23 +0000 (14:31 -0600)
committertsteven4 <13596209+tsteven4@users.noreply.github.com>
Wed, 27 May 2020 20:31:23 +0000 (14:31 -0600)
gui/filterdlg.cc
gui/gmapdlg.cc
gui/gpx.h
gui/mainwindow.cc
gui/map.cc
gui/optionsdlg.cc
gui/preferences.cc
gui/processwait.cc

index 4cec017722075957a73e972786306339ae324523..7ac89c0ab848d194af76b3486e4055b2e33419f7 100644 (file)
@@ -34,7 +34,7 @@ FilterDialog::FilterDialog(QWidget* parent, AllFiltersData& fd): QDialog(parent)
   ui_.filterList->clear();
 
   widgetStack_ = new QStackedWidget(ui_.frame);
-  QHBoxLayout* layout = new QHBoxLayout(ui_.frame);
+  auto* layout = new QHBoxLayout(ui_.frame);
   layout->addWidget(widgetStack_);
   layout->setContentsMargins(2, 2, 2, 2);
 
@@ -74,7 +74,7 @@ FilterDialog::FilterDialog(QWidget* parent, AllFiltersData& fd): QDialog(parent)
 //------------------------------------------------------------------------
 void FilterDialog::addFilterPage(const QString& name, FilterWidget* fw, bool* use)
 {
-  QListWidgetItem* it = new QListWidgetItem(name);
+  auto* it = new QListWidgetItem(name);
   it->setCheckState(*use? Qt::Checked:Qt::Unchecked);
   fw->setEnabled(*use);
   ui_.filterList->addItem(it);
index e03149c565db9fde80bc8b818bc913f9141b3504..ea44ad1e2b908bdf79c41d00ecad9b1418ec2e74 100644 (file)
@@ -145,7 +145,7 @@ GMapDialog::GMapDialog(QWidget* parent, const QString& gpxFileName, QPlainTextEd
   gpx_.read(gpxFileName);
 
   mapWidget_ = new Map(this, gpx_, te);
-  QHBoxLayout* lay = new QHBoxLayout(ui_.frame);
+  auto* lay = new QHBoxLayout(ui_.frame);
   lay->setContentsMargins(0, 0, 0, 0);
   lay->addWidget(mapWidget_);
 
index 85b682384665373a64f8c569480624189473a648..cb01396fb2ab34efe3dee11bf275897972e7efe1 100644 (file)
--- a/gui/gpx.h
+++ b/gui/gpx.h
@@ -126,7 +126,7 @@ public:
         prevPt = thisPt;
       }
     }
-    double* dptr = (double*)(&cachedLength);  // big cheat
+    auto* dptr = (double*)(&cachedLength);  // big cheat
     *dptr = dist;
     return cachedLength;
   }
@@ -352,7 +352,7 @@ public:
         }
       }
     }
-    double* dptr = (double*)(&cachedLength);  // big cheat
+    auto* dptr = (double*)(&cachedLength);  // big cheat
     *dptr = dist;
     return cachedLength;
   }
index adbac733d2fa1e582f153ee8f99b5fd6fa599f65..3e88c8a3ca8e9846f4d9246728c895d2dc6c257f 100644 (file)
@@ -888,10 +888,10 @@ bool MainWindow::isOkToGo()
 bool MainWindow::runGpsbabel(const QStringList& args, QString& errorString,
                              QString& outputString)
 {
-  QProcess* proc = new QProcess(nullptr);
+  auto* proc = new QProcess(nullptr);
   QString name = "gpsbabel";
   proc->start(QApplication::applicationDirPath() + '/' + name, args);
-  ProcessWaitDialog* waitDlg = new ProcessWaitDialog(nullptr, proc);
+  auto* waitDlg = new ProcessWaitDialog(nullptr, proc);
 
   if (proc->state() == QProcess::NotRunning) {
     errorString = QString(tr("Process \"%1\" did not start")).arg(name);
index 9efeb6e09c2da18a51e4d37d5e5e69f0a42fedad..5f366d33550c1d40406aa1260ed53257543dc27e 100644 (file)
@@ -81,8 +81,8 @@ Map::Map(QWidget* parent,
   this->logTime("Start map constructor");
 
 #if HAVE_WEBENGINE
-  MarkerClicker* mclicker = new MarkerClicker(this);
-  QWebChannel* channel = new QWebChannel(this->page());
+  auto* mclicker = new MarkerClicker(this);
+  auto* channel = new QWebChannel(this->page());
   this->page()->setWebChannel(channel);
   // Note: A current limitation is that objects must be registered before any client is initialized.
   channel->registerObject(QStringLiteral("mclicker"), mclicker);
index 43094fd637f3c64602e1bd9ea2c69e680e9035d2..56bafb026803659a8fc3dd5dfa900e276daad57a 100644 (file)
@@ -93,23 +93,23 @@ OptionsDlg::OptionsDlg(QWidget* parent,  const QString& fmtName, QList<FormatOpt
   if (htmlArg.isEmpty()) {
     html_ = "fmt_" + fmtName + ".html";
   }
-  QVBoxLayout* verticalLayout = new QVBoxLayout(this);
+  auto* verticalLayout = new QVBoxLayout(this);
   for (int k=0; k<options_.size(); k++) {
-    QHBoxLayout* horizontalLayout = new QHBoxLayout();
+    auto* horizontalLayout = new QHBoxLayout();
 
-    QCheckBox* checkBox = new QCheckBox(this);
+    auto* checkBox = new QCheckBox(this);
     checkBox->setText(options_[k].getDescription());
     horizontalLayout->addWidget(checkBox);
     checkBox->setChecked(options_[k].getSelected());
     //checkBox->setWhatsThis(options[k].getHtml());
 
-    QSpacerItem* horizontalSpacer = new QSpacerItem(0, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
+    auto* horizontalSpacer = new QSpacerItem(0, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
     horizontalLayout->addItem(horizontalSpacer);
 
     QWidget* w = nullptr;
     switch (options_[k].getType()) {
     case FormatOption::OPTstring: {
-      QLineEdit* lineEdit = new QLineEdit(this);
+      auto* lineEdit = new QLineEdit(this);
       SetSizeStuff(lineEdit);
       lineEdit->setText(getOptionValue(options_, k).toString());
       w = lineEdit;
@@ -120,8 +120,8 @@ OptionsDlg::OptionsDlg(QWidget* parent,  const QString& fmtName, QList<FormatOpt
     case FormatOption::OPTinFile:
     case FormatOption::OPToutFile: {
       bool inFile = options_[k].getType() == FormatOption::OPTinFile;
-      QLineEdit* lineEdit = new QLineEdit(this);
-      QToolButton* button = new QToolButton(this);
+      auto* lineEdit = new QLineEdit(this);
+      auto* button = new QToolButton(this);
       lineEdit->setText(getOptionValue(options_, k).toString());
       button->setIcon(QIcon(inFile ? ":/images/open.png" : ":/images/save.png"));
       w = lineEdit;
@@ -139,14 +139,14 @@ OptionsDlg::OptionsDlg(QWidget* parent,  const QString& fmtName, QList<FormatOpt
       break;
 
     case FormatOption::OPTfloat: {
-      QLineEdit* lineEdit = new QLineEdit(this);
+      auto* lineEdit = new QLineEdit(this);
       SetSizeStuff(lineEdit);
       lineEdit->setText(getOptionValue(options_, k).toString());
       w = lineEdit;
       double minVal = options_[k].getMinValue().toDouble();
       double maxVal = options_[k].getMaxValue().toDouble();
       if (minVal < maxVal) {
-        QDoubleValidator* v = new QDoubleValidator(this);
+        auto* v = new QDoubleValidator(this);
         v->setRange(minVal, maxVal);
         lineEdit->setValidator(v);
       }
@@ -155,13 +155,13 @@ OptionsDlg::OptionsDlg(QWidget* parent,  const QString& fmtName, QList<FormatOpt
     break;
 
     case FormatOption::OPTint: {
-      QLineEdit* lineEdit = new QLineEdit(this);
+      auto* lineEdit = new QLineEdit(this);
       SetSizeStuff(lineEdit);
       w = lineEdit;
       int minVal = options_[k].getMinValue().toInt();
       int maxVal = options_[k].getMaxValue().toInt();
       if (minVal < maxVal) {
-        QIntValidator* iv = new QIntValidator(this);
+        auto* iv = new QIntValidator(this);
         iv->setRange(minVal, maxVal);
         lineEdit->setValidator(iv);
       }
@@ -171,7 +171,7 @@ OptionsDlg::OptionsDlg(QWidget* parent,  const QString& fmtName, QList<FormatOpt
     break;
 
     case FormatOption::OPTboundedInt: {
-      QSpinBox* spinBox = new QSpinBox(this);
+      auto* spinBox = new QSpinBox(this);
       spinBox->setRange(options_[k].getMinValue().toInt(),
                         options_[k].getMaxValue().toInt());
       spinBox->setValue(getOptionValue(options_, k).toInt());
@@ -197,11 +197,11 @@ OptionsDlg::OptionsDlg(QWidget* parent,  const QString& fmtName, QList<FormatOpt
 
     verticalLayout->addLayout(horizontalLayout);
   }
-  QPushButton* helpButton = new QPushButton(this);
+  auto* helpButton = new QPushButton(this);
   helpButton->setIcon(QIcon(":/images/help.png"));
   helpButton->setText(tr("Help"));
 
-  QHBoxLayout* lay = new QHBoxLayout();
+  auto* lay = new QHBoxLayout();
   lay->addWidget(helpButton);
 
   buttonBox_ = new QDialogButtonBox(this);
index f648324bd4b880767d25673e74f546ecaf8428fb..fbed65695a56844669b0274464f9508102c82d85 100644 (file)
@@ -56,7 +56,7 @@ Preferences::Preferences(QWidget* parent, QList<Format>& formatList,
   connect(ui_.disableAllButton, SIGNAL(clicked()), this, SLOT(disableAllClicked()));
 
   for (int i = 0; i < formatList_.size(); i++) {
-    FormatListEntry* item = new FormatListEntry(formatList[i]);
+    auto* item = new FormatListEntry(formatList[i]);
 
     ui_.enabledFormatsList->addItem(item);
   }
index 93bb4d20668b221d42b6fee00e1eed858e544204..33a4ef84976dcf763bdf380774fdfb79a59065aa 100644 (file)
@@ -65,7 +65,7 @@ ProcessWaitDialog::ProcessWaitDialog(QWidget* parent, QProcess* process):
 {
   this->resize(400, 220);
   this->setWindowTitle(QString(appName) + tr(" ... Process GPSBabel"));
-  QVBoxLayout* layout = new QVBoxLayout(this);
+  auto* layout = new QVBoxLayout(this);
 
   textEdit_ = new QPlainTextEdit(this);
   textEdit_->setReadOnly(true);